package com.dreem.builder.improve;

/**
 * @program: DesignParrtern
 * @description: 房子建造者
 * @author: Peng
 * @create: 2021-01-29  10:45
 **/
public class HouseDirector {
    private HouseBuilder houseBuilder = null;

    // 构造器传参
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    // setter传参
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public House constructHouse(){
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.buildRoof();
        return houseBuilder.buildHouse();
    }
}
